<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html> 
<html>
<%
	Object loginedRole = (Object) request.getAttribute("loginedRole");
	Person currentUser = (Person) request.getAttribute("currentUser");
%>
<head>
	<jsp:include page="./header.jsp" />
	
	<%@page import="java.util.*"%>
	<%@page import="util.*"%>
	<%@page import="domain.*"%> 
	
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>Intelligent Route System</title>

	<script type="text/javascript">
	  
		function submitMenu(url){
			document.forms["menuSubmit"].method = "get";
			document.forms["menuSubmit"].action = "./"+url;
			document.forms["menuSubmit"].submit();
		}
		
		function logoutSubmit(url){
			document.forms["logoutSubmit"].method = "get";
			document.forms["logoutSubmit"].action = "./"+url;
			document.forms["logoutSubmit"].submit();
		}
			
	</script>
</head>
<body>
	<div data-role="page" data-theme="a" >

	<div data-role="header" data-position="inline">
		<h1>IRS</h1>
		<form id="logoutSubmit">
			<input type="hidden" name="todo" value="logout"/>
		</form>
		<a href="javascript:logoutSubmit('Login')" class="ui-btn-right">Log Out</a>
	</div><!-- /header -->

	<div data-role="content" >	
		<form id="menuSubmit"></form>
		<ul data-role="listview" data-theme="a">
			<%if(loginedRole!=null) {
				if(loginedRole instanceof LogisticManager){
			%>
					<li><a href="javascript:submitMenu('ManageSchedule')">Manage Schedule</a></li>
					<li><a href="javascript:submitMenu('TrackVehicle')">Track Delivery Status</a></li>
				<%}else if (loginedRole instanceof Driver){%>
					<li><a href="javascript:submitMenu('GetSchedule')">Get Schedule</a></li>
				<%}else if(loginedRole instanceof TopManager){ %>
					<li><a href="javascript:submitMenu('GetStatistics')">Get Delivery Statistics</a></li>
				<%} %>
			<%} %>
		</ul>

	</div><!-- /content -->

	<div data-role="footer">
		<h4><%=currentUser.getFullName() %></h4>
	</div><!-- /footer -->
	</div><!-- /page -->
</body>
</html>